Python system call

this is almost certainly not the best way to read the output of a python system call. but, it works. let’s say i’d like to read the results of a call to ls. here’s how to do it:

import subprocess
proc = subprocess .Popen([ls],stdout=sub.PIPE)
print proc.stdout.read()

reference: read the output of a system call in python

Homepage
Comments

Hide Comments